<%@page import="databaseLayer.RecordLookUp" %>
<%@page import="userBean.PurchaseRecord" %>

<div>
    <h2>Authorize Refund Request</h2>
    <form name="authorizeRefundRequest" method="post" action="Refund.do">
        <% PurchaseRecord[] refundRecord = RecordLookUp.getWaitingRefundRecord();%>
        <p> There are <%= refundRecord==null?0:refundRecord.length %> record(s) waiting to be refunded. </p>
        <div style="display:<%= refundRecord==null?"none":"block" %>" >
        <table width="650">
            <tr class="odd">
                <td>Transaction Time</td>
                <td>Movie Name</td>
                <td>Number of Tickets</td>
                <td>Total Price</td>
                <td>Used Loyalty Point</td>
                <td>&nbsp;</td>
            </tr>
            <% for (int i = 0; refundRecord != null && i < refundRecord.length; i++) {%>
            <tr class="<%= i % 2 == 0 ? "even" : "odd"%>">
                <td> <%= refundRecord[i].getPurchaseTime()%></td>
                <td> <%= refundRecord[i].getMovieName()%></td>
                <td> <%= refundRecord[i].getAmount()%></td>
                <td> <%= refundRecord[i].getTotalPrice()%></td>
                <td> <%= refundRecord[i].getUsedLoyaltyPoint()%></td>
                <td> <input type="checkbox" name="toBeRefund" value="<%= refundRecord[i].getRecordID()%>" </td>
            </tr>
            <% }%>
        </table>
        <p>
            <input type="hidden" name="action" value="approveRefund">
            <input type="submit" name="approve" id="approve" value="Approve"></p>
        </div>
    </form>
</div>